package com.liangxy.news.model;

import com.google.gson.annotations.SerializedName;

/**
 * Represents the result object in the news detail API response
 */
public class NewsDetailResult {
    
    @SerializedName("uniquekey")
    private String uniquekey;
    
    @SerializedName("content")
    private String content;
    
    @SerializedName("detail")
    private NewsDetailInfo detail;
    
    public String getUniquekey() {
        return uniquekey;
    }
    
    public void setUniquekey(String uniquekey) {
        this.uniquekey = uniquekey;
    }
    
    public String getContent() {
        return content;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    
    public NewsDetailInfo getDetail() {
        return detail;
    }
    
    public void setDetail(NewsDetailInfo detail) {
        this.detail = detail;
    }
    
    /**
     * Convert to News object
     * @return News object
     */
    public News toNews() {
        News news = new News();
        news.setUniquekey(uniquekey);
        news.setContent(content);
        
        if (detail != null) {
            news.setTitle(detail.getTitle());
            news.setDate(detail.getDate());
            news.setCategory(detail.getCategory());
            news.setAuthor_name(detail.getAuthorName());
            news.setUrl(detail.getUrl());
            news.setThumbnail_pic_s(detail.getThumbnailPicS());
            news.setThumbnail_pic_s02(detail.getThumbnailPicS02());
            news.setThumbnail_pic_s03(detail.getThumbnailPicS03());
        }
        
        return news;
    }
} 